package com.llyb.config;

import com.llyb.inter.ChatAssistant;
import dev.langchain4j.model.chat.ChatModel;
import dev.langchain4j.model.openai.OpenAiChatModel;
import dev.langchain4j.service.AiServices;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class LLMConfig {

    @Bean(name = "qwen")
    public ChatModel chatModelQwen(){
        return OpenAiChatModel.builder().
                apiKey(System.getenv("aliQwen-api")).
                modelName("qwen-plus").
                baseUrl("https://dashscope.aliyuncs.com/compatible-mode/v1").
                build();
    }

    @Bean(name = "deepseek")
    public ChatModel chatModelDeepseek(){
        return OpenAiChatModel.builder().
                apiKey(System.getenv("deepseek-api")).
                modelName("deepseek-chat").
//                modelName("deepseek-reasoner").
                baseUrl("https://api.deepseek.com/v1").
                build();
    }

    @Bean
    public ChatAssistant chatAssistant(@Qualifier("qwen")ChatModel chatModelQwen){
        return AiServices.create(ChatAssistant.class,chatModelQwen);
    }

}